import csv

if __name__ == '__main__':
    with open('603615.csv')as f:
        f_csv = csv.DictReader(f)
        a = [i for i in f_csv]
    a.reverse()
    headers = ['日期', '股票代码', '名称', '收盘价', '最高价', '最低价']
    with open('603615rev.csv', 'w', newline='')as f:
        f_csv = csv.DictWriter(f, headers)
        f_csv.writeheader()
        f_csv.writerows(a)
